#include "StdAfx.h"
#include "SkyShader.h"

VAMPIRE_NAMESPACE_BEGIN

REGISTER_HELPER_IMPLEMENT(SkyShader);

void SkyShader::bindHandles()
{
	mhModelViewProj = mpData->GetParameterByName(NULL, "modelViewProj");
	mhTexture       = mpData->GetParameterByName(NULL, "cubeTexture");
	mhWorldMat      = mpData->GetParameterByName(NULL, "worldMat");
	mhEyePos        = mpData->GetParameterByName(NULL, "eyePos");
}

void SkyShader::setTransformMatrix( const Matrix44& mat )
{
	mModelViewProjMat = mat;
	mpData->SetMatrix(mhModelViewProj, &(mModelViewProjMat.mData));
}

void SkyShader::setEyePosition( const Vector3& pos )
{
	mEyePos = pos;
	mpData->SetVector(mhEyePos, (D3DXVECTOR4*)&(mEyePos.mData));
}

void SkyShader::setTexture( Texture* tex )
{
	mpTexture = tex;
	mpData->SetTexture(mhTexture, mpTexture->mpData);
}

void SkyShader::setWorldMatrix( const Matrix44& mat )
{
	mWorldMat = mat;
	mpData->SetMatrix(mhWorldMat, &(mWorldMat.mData));
}

VAMPIRE_NAMESPACE_END